<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018\1\6 0006
 * Time: 17:48
 */
namespace app\admin\model;

use think\Model;

class AppActive extends Model{
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;

    protected $createTime = 'create_time';

    protected $updateTime = '';

    protected $dateFormat = 'Y-m-d H:i:s';
    /**
     * 获取所有app登录信息
     * @author 王柯 <wangke.email@foxmail.com>
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function getAll($where = ''){
        $data = $this->where($where)->select();
        foreach ($data as $key => $val){
            $data[$key] = $val->toArray();
        }
        return $data;
    }

    /**
     * 获取所有app登录信息总数
     * @author 王柯 <wangke.email@foxmail.com>
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function getCount($where = ''){
        $count = $this
            ->where($where)
            ->count();
        return $count;
    }
}